package com.qc.service.impl;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.qc.enity.Goods;
import com.qc.enity.Login;
import com.qc.enity.Message;
import com.qc.mapper.LoginMapper;
import com.qc.mapper.MessageMapper;
import com.qc.service.IMessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.messaging.handler.annotation.MessageMapping;
import org.springframework.stereotype.Service;

import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
@Service
public class MessageServiceImpl  extends ServiceImpl<MessageMapper, Message> implements IMessageService {
    @Autowired
    private MessageMapper messageMapper;
    @Override
    public List<Message> messageList(Integer userid) {
        LambdaQueryWrapper<Message> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(Message::getUserId, userid);
        List<Message> messageList = messageMapper.selectList(queryWrapper);
        return  messageList;
    }

    @Override
    public int saveMessage(Message message) {
        int insert = messageMapper.insert(message);
        return insert;
    }
}
